<?php

namespace IDock\Insurance\AICS\Request;

use IDock\Insurance\AICS\AICSEnums;
use IDock\Insurance\AICS\Request\AllAICSRequest;
use IDock\Insurance\AICS\Response\NonCarProductListResponse;
use IDock\Visitor\NonCar\NonCarProductListVisitor;

class NonCarProductListRequest extends AllAICSRequest
{
    public $code = 'NewQueryYwCvrgWebService';

    public $envelopeName = 'tns:newQueryYwCvrg';

    public $schemeNo = '';

    protected $urlTip = '非车产品列表';

    protected $response = NonCarProductListResponse::class;

    /*** @var NonCarProductListVisitor $visitor */
    protected $visitor;

    public function generate(): array
    {
        $CProdNo = '';
        if($this->visitor->hasCi){
            $CProdNo = 'DJ';
        }
        if($this->visitor->hasBi){
            $CProdNo = 'DS';
        }
        if($this->visitor->hasCi and $this->visitor->hasBi){
            $CProdNo = 'JS';
        }
        return [
            'deptcde' => substr($this->visitor->argc['CDptCde'] ?? '',0,2),
            'seatsNum' => $this->visitor->seats,
            'schemeNo' => $this->schemeNo,
            'CUsageCde' => AICSEnums::$useNatureCode[$this->visitor->useNatureCode] ?? '',//非营业
            'CProdNo' => $CProdNo,//非营业
        ];
    }
}
